<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
document.addEventListener('DOMContentLoaded',function () {
        alert(1)
});

window.onload = function () {
        alert(2)
}
// 分别是dom加载完成, 和 页面资源加载完成（当阻塞资源与非阻塞资源全部加载完才会触发）

// 显然 window.onload 是比较DOMContentLoaded 要晚触发的
</script>
</html>